<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'project-form',
    'enableAjaxValidation'=>false,
)); ?>

<p class="note"><?php echo Yii::t('site','Fields with {marker} are required.',array('{marker}'=>'<span class="required">*</span>')); ?></p>

    <?php echo $form->errorSummary($model); ?>

    <?php if(Yii::app()->getRequest()->getParam('Project_page')) echo CHtml::hiddenField('Project_page',Yii::app()->getRequest()->getParam('Project_page')); ?>
    <div class="row">
        <?php echo $form->labelEx($model,'name'); ?>
        <?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
        <?php echo $form->error($model,'name'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'description'); ?>
        <?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
        <?php echo $form->error($model,'description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'isPublic'); ?>
        <?php echo $form->checkBox($model,'isPublic'); ?>
        <?php echo $form->error($model,'isPublic'); ?>
    </div>

    <div class="row">
        <?php echo CHtml::label('Project Members','members-grid'); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$model->membersDataProvider,
    'template'=>'{summary}{items}',
    'id'=>'members-grid',
    'columns'=>array(
        array(
            'name'=>'fullname',
            'header' => Yii::t('site','Name'),
        ),
        array(
            'name'=>'email',
            'header'=> Yii::t('site','Email'),
            'type'=>'raw',
            'value'=>'CHtml::mailto($data[\'email\'])',
        ),
        array(
            'class'=>'CCheckBoxColumn',
            'id'=>'RemoveMembers',
            'header'=>Yii::t('site','Remove'),
            'value'=>'$data[\'memberId\']',
            'selectableRows'=>2,
        ),
    ),
)); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'newMembersEmails'); ?>
        <?php echo $form->textArea($model,'newMembersEmails',array('rows'=>3, 'cols'=>40)); ?>
        <small><?php echo CHtml::encode(Yii::t('site','Enter new member email addresses, separated by commata (,) or new lines.')); ?></small>
        <?php echo $form->error($model,'newMembersEmails'); ?>
    </div>

    <div class="row buttons">
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>$model->isNewRecord?Yii::t('site','Create'):Yii::t('site','Save'),
				'linkTitle'=>$model->isNewRecord?Yii::t('site','Create this record'):Yii::t('site','Save this record'),
				'formID' => 'project-form',
				'buttonType' => 'save'
		)); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>Yii::t('site','Reset'),
				'linkTitle'=>Yii::t('site','Reset the form data'),
				'formID' => 'project-form',
				'buttonType' => 'reset',
				'confirm' => Yii::t('site','Really reset this form?')
		)); ?>
        <?php $this->widget( 'application.extensions.button.DDButton',
			array(
				'title'=>Yii::t('site','Cancel'),
				'linkTitle'=>Yii::t('site','Cancel editing, back to list'),
				'formID' => 'project-form',
				'buttonType' => 'cancel',
				'confirm' => Yii::t('site','Really cancel editing this item?'),
				'url' => array('project/admin','Project_page'=>$page)
		)); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
